package com.fp.m7.client.widget;

import com.google.gwt.user.client.ui.DecoratedPopupPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;

/**
 * Helper for displaying a popup with some simple text message on the side of provided widget.
 * 
 * @author 7
 */
public class InfoPopup {

    public static void showPopup(Widget source, String contents) {
        final DecoratedPopupPanel simplePopup = new DecoratedPopupPanel(true);
        simplePopup.setWidth("240px");
        simplePopup.setWidget(new HTML(contents));

        int left = source.getAbsoluteLeft() + 120;
        int top = source.getAbsoluteTop() + 10;
        simplePopup.setPopupPosition(left, top);

        simplePopup.show();
    }
}
